
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户中心</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <script type="text/javascript" src="js/libs/modernizr.min.js"></script>
</head>
<body>
<div class="topbar-wrap white">
    <div class="topbar-inner clearfix">
    </div>
</div>
<div class="container clearfix">
    <div class="sidebar-wrap">
        <div class="sidebar-title">
            <h1>菜单</h1>
        </div>
        <div class="sidebar-content">
            <ul class="sidebar-list">
                <li>
                    <a href="#"><i class="icon-font">&#xe003;</i>常用操作</a>
                    <ul class="sub-menu">        
                        <li><a href="customer-myguest.php"><i class="icon-font">&#xe005;</i>我的留言</a></li>
                        <li><a href="customer-preson.php"><i class="icon-font">&#xe006;</i>个人信息</a></li>
                        <li><a href="customer-guest.php"><i class="icon-font">&#xe008;</i>开始留言</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="index.html">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">开始留言</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="customer-guest.php" method="post" id="myform" name="myform" enctype="multipart/form-data">
                    <table class="insert-tab" width="100%">
                        <tbody>
                            <tr>
                                <th><i class="require-red">*</i>个人邮箱：</th>
                                <td>
                                    <input class="common-text required" id="price" name="email" size="15" value="" type="text">
                                </td>
                            </tr>
                            <tr>
                                <th>留言内容：</th>
                                <td><textarea name="content" class="common-textarea" id="content" cols="30" style="width: 98%;" rows="10"></textarea></td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" value="发布" type="submit" name="submit">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                            <tr><td></td><td>
        <?php   
            include "shuju.php";
            if (isset($_POST['submit'])) {
                $email = $_POST['email'];
                $content = $_POST['content'];
                $date = date('Y-m-d H:i:s');
                $db = new DB();
                    $sql = "select id from user where email = '$email'";
                    $e = $db->get($sql);
                    $s = $e[0][0];
                if (empty($email) || empty($content)) {
                    header('loaction:customer-guest.php');
                }else{  
                    $res = $db->insert("insert into ly values(null,'$s',null,'$email','$content',null,'$date',null)");
                   // echo "null,'$s',null,'$email','$content',null,'$date',null";
                    if (!$db->insert($sql)) {
                        echo "留言失败".$db->error;
                    }else{
                        echo "留言成功!";
                    }
                }
            }   
     ?>
                            </td></tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
</div>
</body>
</html>